package Test1011;

import java.util.Scanner;

public class Hollow {
    public static void main(String[] args) {
        //1:输出空心矩形，矩形的高和宽用户输入， 必须都大于等于3，否则要求重新输入；
        //比如，输入3和5，则最后的图形如下
        Scanner input = new Scanner(System.in);
        System.out.println("矩形的长和高必须都大于等于3");
        System.out.println("请输入矩形的长");
        int chang = input.nextInt();
        System.out.println("请输入矩形的高");
        int gao = input.nextInt();
        while (chang<3&&gao<3)
        {
            System.out.println("输入有误请重新输入");
            System.out.println("请输入矩形的宽");
            chang = input.nextInt();
            System.out.println("请输入矩形的高");
            gao = input.nextInt();
        }
        int i = 0;
        for (; i <gao ; i++) {
            for (int j = 0; j <chang ; j++) {
                {
                    //System.out.print("*");
                    if(i >= 1 && i<gao-1){
                        if(j ==0){
                            System.out.print("*");
                        }else  if(j == chang-1){
                            System.out.print("*");
                        }else{
                            System.out.print(" ");
                        }
                    }else{
                        System.out.print("*");
                    }
                }
            }

            System.out.println();
        }


    }
}
